package com.alibaba.shop.provider.controller;

import com.alibaba.shop.common.dto.ShopDto;
import com.alibaba.shop.common.vo.R;
import com.alibaba.shop.provider.service.intf.ShopService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @auther 14632
 * @date 2021/9/6 19:48
 */
@RestController
@RequestMapping("/provider/shop")
public class ShopController {

    @Autowired
    private ShopService shopService;

    //新增
    @PostMapping("/save.do")
    public R save(@RequestParam ShopDto shopDto){
        return shopService.save(shopDto);
    }

    //删除
    @DeleteMapping("/delete.do")
    public R del(@RequestParam long id){
        return shopService.del(id);
    }

    //店铺列表搜索,根据定位，进行排序
    @GetMapping("/searchlist.do")
    public R list(@RequestParam double lat, @RequestParam double lon){
        return shopService.searchList(lon,lat);
    }

    //根据定位搜索，指定半径内的数据
    @GetMapping("/searchradio.do")
    public R circle(@RequestParam double lat, @RequestParam double lon, @RequestParam int lenth){
        return shopService.searchCircle(lat, lon, lenth);
    }


}
